#include <bits/stdc++.h>
#define N (int)1e5+5
using namespace std;
int n;
int res=0,sgn=0;
int a[N],rk[N],cnt[N];
signed main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i=1;i<=n;++i) scanf("%d",&a[i]);
    sort(a+1,a+n+1);
    for(int i=1;i<=n;++i)
    {
        if(a[i]>a[i-1]) rk[a[i]]=rk[a[i-1]]+cnt[a[i-1]];
        cnt[a[i]]++;
    }
    for(int i=1;i<=n;++i)
    {
        if(rk[a[i]]<=sgn) continue;
        else res++,sgn++;
    }
    printf("%d\n",n-res);
    return 0;
}